package com.dhl.open;

/**
 * @title: Open
 * @Author danghailiang
 * @Date: 2022/7/25 11:50
 * @Version 1.0
 */
public class Open {
    public static void main(String[] args) {
        new GraphicEditor().drawShape(new Circle());
        new GraphicEditor().drawShape(new Retangle());
    }
}
class  GraphicEditor{
    public void drawCircle(){
        System.out.println("化了圆形");
    };
    public void drawShape(Shape shape){
       if(shape.type == 1){
            this.drawCircle();
       }else if(shape.type == 2){
           this.drawRetangle();
       }
    };
    public void drawRetangle() {
        System.out.println("化了矩形");
    }
}
class Shape{
    public int type;
}
class Circle extends Shape{
    public Circle(){
        this.type = 1;
    }
}
class Retangle extends Shape{
    public Retangle(){
        this.type = 2;
    }
}


